package com.sgb.kjwl.view.widget.map;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.sgb.kjwl.R;
import com.swgk.core.dialog.BasePopWindow;
import com.swgk.core.dialog.PopViewHolder;

public class PackerMapInfoPop3 extends BasePopWindow {

    private TextView startView;
    private TextView endView;
    private TextView navigationView;
    private ImageView closeView;
    private PopCallBack popCallBack;

    public PackerMapInfoPop3(Context context) {
        super(context, DIR_DOWN_UP);
    }

    @Override
    protected int popLayout() {
        return R.layout.packer_map_info_pop3;
    }

    @Override
    protected void initView(PopViewHolder holder) {
        startView = holder.getPop().findViewById(R.id.start_view);
        endView = holder.getPop().findViewById(R.id.end_view);
        closeView = holder.getPop().findViewById(R.id.close_view);
        navigationView = holder.getPop().findViewById(R.id.navigation_view);
        navigationView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (popCallBack == null) {
                    return;
                }
                popCallBack.onClickNavigation();
            }
        });
        closeView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }

    public PackerMapInfoPop3 setStartData(String start) {
        startView.setText(start);
        return this;
    }

    public PackerMapInfoPop3 setEndData(String end) {
        endView.setText(end);
        return this;
    }


    public interface PopCallBack {
        void onClickNavigation();
    }

    public PackerMapInfoPop3 setPopCallBack(PopCallBack popCallBack) {
        this.popCallBack = popCallBack;
        return this;
    }
}
